package cn.zysuyuan.item.controller;

import cn.zysuyuan.item.service.EasyMockDataService;
import com.alibaba.fastjson.JSONObject;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.http.ResponseEntity;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

/**
 * @author flypig
 * @version 1.0
 * @date 2020-04-05 16:53
 */

@RestController
@RequestMapping("easymock")
public class EasyMockDataController {

    @Autowired
    private EasyMockDataService easyMockDataService;

    @GetMapping("/warning/mess")
    public ResponseEntity<JSONObject> getWarningMess() {
        JSONObject json  = easyMockDataService.getWarningMess();
        return ResponseEntity.ok(json);
    }

    @GetMapping("/all/mess")
    public ResponseEntity<JSONObject> getTypeMess() {
        JSONObject json  = easyMockDataService.getTypeMess();
        return ResponseEntity.ok(json);
    }

    @GetMapping("/data/today")
    public ResponseEntity<JSONObject> getTableData() {
        JSONObject json  = easyMockDataService.getTableData();
        return ResponseEntity.ok(json);
    }

    @GetMapping("/data/today/select")
    public ResponseEntity<JSONObject> selectTableData() {
        JSONObject json  = easyMockDataService.selectTableData();
        return ResponseEntity.ok(json);
    }

    @GetMapping("/mess/device")
    public ResponseEntity<JSONObject> getAllDevice() {
        JSONObject json  = easyMockDataService.getAllDevice();
        return ResponseEntity.ok(json);
    }
}
